﻿<%@ page language="java" import="com.newcrm.config.Const,com.newcrm.util.Util,com.newcrm.bean.*,java.util.List,java.util.Map" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
  User user = (User) session.getAttribute("user");
  Map<Integer, CompanyInfo> companys = (Map<Integer, CompanyInfo>) application.getAttribute(Const.APPLICATION_COMPANYS);
  CompanyInfo companyInfo = companys.get(Integer.valueOf(user.companyId));
  List<Group> allGroups = companyInfo.getAllGroups();

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>部门管理</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta name="renderer" content="webkit"/>
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <link rel="shortcut icon" href="<%=request.getContextPath()%>/images/qikebao.ico" />
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/all.css?ver=<%=Const.VERSION%>">
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/datepicker.css" />
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/bootstrap-datetimepicker.min.css" />
  <link rel="stylesheet" href="<%=request.getContextPath()%>/css/magnific-popup.css">
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery-1.11.1.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/bootstrap.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery-ui.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery.bootstrap-growl.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/moment.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/bootstrap-datepicker.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/bootstrap-datetimepicker.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/bootstrap-treeview.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/daterangepicker.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery.magnific-popup.min.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/jquery.cookie.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/popbox.js"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/common.js?ver=<%=Const.VERSION%>"></script>
  <script type="text/javascript" src="<%=request.getContextPath()%>/script/group.js?ver=<%=Const.VERSION%>"></script>
  <script>
    var nodeData = new Array();
  	<% if (allGroups != null) {
         for (Group group:allGroups) {
  	%>
    nodeData.push({id:<%=group.getId()%>,parentId:<%=group.getParentId()%>,text:"<%=Util.UEncode2(group.getName())%>"});
  	<%   }
  		  }
  	%>
  </script>
</head>
<body class="parties">
  <jsp:include page="topNavi.jsp" flush="true"/>
  <div class="main-page">
    <table>
    <tr>
      <td class="main-body">
        <div class="topnavi">
          <div class='leftMenu'><span>部门管理</span></div>
        </div>
        <div class="toolbar">
          <a href="0" title="添加一级部门" class="addGroup button grey small"><i class="fa fa-plus"></i> 添加一级部门</a>
        </div>
        <div class="groups">
          <ul id="node_container_0"></ul>
        </div>
      </td>
      <td class="main-sidebar">
        <div class="content">
          <div class="liner">
            <div class="sidebox closedbox">
              <h5>部门概念</h5>
              <p>可以按员工的职能或者分工来创建不同的部门，比如销售一部，销售二部，客服部门等。</p>
            </div>
          </div>
        </div>
      </td>
    </tr>
    </table>
  </div>

   <div id="groupModel" class="white-popup mfp-hide">
    <div class="popup-title"><span class="title">添加/修改部门</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      <div class="new">
        部门名称：
        <input type="text" id="groupName" placeholder="请输入部门名称" value=""/>
        <div class="warnningRed"></div>
      </div>
    </div>
    <div class="buttonbar">
      <div class="right">
        <a id="addGroup-link" class="button blue small" href="#"><i class="fa fa-check"></i> 确定</a>
        <a class="button grey small popup-close-button" href="#"><i class="fa fa-times"></i> 取消</a>
      </div>
      <div class="message"></div>
    </div>
  </div>

  <div id="groupSelectModel" class="white-popup mfp-hide">
    <div class="popup-title"><span class="title">选择需要转移的部门</span> <span class="popup-close-button"><i class="fa fa-times"></i>&nbsp;</span></div>
    <div class="popup-content">
      部门一览：
      <label><input id='group_' name='contactPeople' v='' checked type='radio' value='' /> 无</label>
    </div>
    <div class="buttonbar">
      <div class="right">
        <a id="selectGroup-link" class="button blue small" href="#"><i class="fa fa-check"></i> 确定</a>
        <a class="button grey small popup-close-button" href="#"><i class="fa fa-times"></i> 取消</a>
      </div>
      <div class="message"></div>
    </div>
  </div>
</body>
</html>